<template>
    <div class="user">
        <!-- 左侧路由导航区域 -->
        <div class="menu">
            <div class="top">
                <el-icon><House /></el-icon>
                <span> / 会员中心</span>
            </div>
            <el-menu :default-active="route.path" class="el-menu-vertical-demo">
            <el-menu-item index="/user/certification" @click="gotoRight('/user/certification')">
              <el-icon><Postcard/></el-icon>
              <span>实名认证</span>
            </el-menu-item>
            <el-menu-item index="/user/order" @click="gotoRight('/user/order')">
              <el-icon><document /></el-icon>
              <span>挂号订单</span>
            </el-menu-item>
            <el-menu-item index="/user/patient" @click="gotoRight('/user/patient')">
              <el-icon><User /></el-icon>
              <span>就诊人管理</span>
            </el-menu-item>
            <el-menu-item index="/user/profile" @click="gotoRight('/user/profile')">
                <el-icon><DocumentCopy /></el-icon>
            <span>账号信息</span>
                </el-menu-item>
            <el-menu-item index="/user/feedback" @click="gotoRight('/user/feedback')">
                <el-icon><ChatDotRound /></el-icon>
                <span>意见反馈</span>
            </el-menu-item>
          </el-menu>
        </div>
        
        <!-- 右侧路由展示区域 -->
        <div class="content">
            <!-- 子路由展示区域 -->
            <router-view></router-view>
        </div>
    </div>
</template>

<script setup lang="ts">
import { Document, Postcard, DocumentCopy, House, User, ChatDotRound } from '@element-plus/icons-vue'
// 引入路由器
import { useRouter,useRoute } from 'vue-router';
// 获取路由器实例
let router = useRouter();
let route = useRoute();

// 点击左侧菜单路由跳转
const gotoRight = (path:string) =>{
    router.push({path:path})
}
</script>

<style scoped>
.user{
    display: flex;
    margin-top: 17px;
    .menu{
        flex: 2;
        .top{
            margin-left: 30px;
            margin-bottom: 10px;
            font-size: 14px;
            color: #7f7f7f;
            display: flex;
            align-items: center;
            span{
                margin-left: 5px;
            }
        }
    }
    .content{
        flex: 10;
        margin-left: 20px;
    }
}
</style>